package com.morningstar.flow.flowable.assigne;

import com.morningstar.flow.antvX6.common.Assign;
import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.impl.persistence.entity.ExecutionEntityImpl;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

@Slf4j
@Component
public class AssigneeStrategyStartUser extends AssigneeStrategyHandler implements InitializingBean {
    @Override
    public List<String> handler(Assign assign, ExecutionEntityImpl execution) {
        List<String> assigneeList = new ArrayList<>();
        assigneeList.add(execution.getVariable("START_USER").toString());
        return assigneeList;
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        register(AssigneeStrategy.STRATEGY_START_USER, this);
    }
}
